from flask import Blueprint, render_template

log_bp = Blueprint('log', __name__, template_folder='templates/features/log.html')


@log_bp.after_request
def add_cors_headers(response):
    response.headers['Access-Control-Allow-Origin'] = '*'  # 允许所有来源跨域访问，如需限制可替换为具体域名
    response.headers['Access-Control-Allow-Headers'] = 'Content-Type,Authorization'
    response.headers['Access-Control-Allow-Methods'] = 'GET,POST,PUT,DELETE,OPTIONS'
    return response


@log_bp.route('/api/mgmt/log', methods=['GET', 'POST'])
def log():
    print("日志")
    return render_template('features/log.html')
